//
//  GYJournalTableViewCell.m
//  LockManagement
//
//  Created by apple on 2018/7/27.
//  Copyright © 2018年 yunjiazhineng. All rights reserved.
//

static NSString *journalCelldentifier = @"journalCelldentifier";

#import "GYJournalTableViewCell.h"

@interface GYJournalTableViewCell()
@property (weak, nonatomic) IBOutlet UILabel *journalTypeLable;
@property (weak, nonatomic) IBOutlet UILabel *journalTimeLable;
@property (weak, nonatomic) IBOutlet UILabel *journalNameLbale;

@property (weak, nonatomic) IBOutlet UILabel *journalObjLable;
@property (weak, nonatomic) IBOutlet UILabel *journalResultLable;
@property (weak, nonatomic) IBOutlet UIView *backGroundView;

@end

@implementation GYJournalTableViewCell

+ (instancetype)cellWithTbaleView:(UITableView *)tableView {
    GYJournalTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:journalCelldentifier];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil] firstObject];
    }
    
    return cell;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.backGroundView.layer.shadowColor = HEXColor(0x080808).CGColor;
    self.backGroundView.layer.shadowOpacity = 1.0;
    self.backGroundView.layer.shadowOffset = CGSizeMake(0, 0);
    
}

- (void)setModel:(GYJournal *)model {
    _model = model;
    
    self.journalTypeLable.text = model.logType == 1 ? @"开关锁" : @"巡更";
    self.journalTimeLable.text = model.logTime;
    self.journalNameLbale.text = model.userName;
    self.journalObjLable.text = model.lockName;
    self.journalResultLable.text = model.logState == 1 ? @"成功" : @"失败";
}

- (CGFloat)cellHeight {
    return CGRectGetMaxY(self.journalResultLable.frame)+15;
}



@end
